Skip to content

Conversation

@pboling
Copy link
Member

@pboling pboling commented Nov 6, 2025

Support for SCRIPT_NAME for proper URL generation

  • behind certain proxies/load balancers, or
  • under a subdirectory

Expands on, and replaces, #16

@pboling pboling self-assigned this Nov 6, 2025
Copilot AI review requested due to automatic review settings November 6, 2025 03:05
@codecov
Copy link

codecov bot commented Nov 6, 2025

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 97.55%. Comparing base (0ad4532) to head (3ea1562).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
lib/omniauth/strategies/ldap.rb 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #104      +/-   ##
==========================================
+ Coverage   97.54%   97.55%   +0.01%     
==========================================
  Files           4        4              
  Lines         244      245       +1     
  Branches       67       67              
==========================================
+ Hits          238      239       +1     
  Misses          6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds support for SCRIPT_NAME to properly generate callback URLs when the application is mounted under a subdirectory (e.g., behind a reverse proxy or using Rack::URLMap). The key change is replacing callback_path with callback_url in the LDAP strategy to ensure absolute URLs include the subdirectory prefix.

  • Changed callback_path to callback_url in redirects and form actions
  • Added comprehensive test coverage for subdirectory mounting scenarios
  • Added documentation explaining SCRIPT_NAME support and configuration examples

Reviewed Changes

Copilot reviewed 37 out of 38 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
lib/omniauth/strategies/ldap.rb Updated to use callback_url instead of callback_path for redirects and form action; refactored filter method to avoid shadowing variable name
spec/omniauth/strategies/ldap_spec.rb Updated existing test expectations and added new test contexts for subdirectory and nested subdirectory scenarios
spec/integration/middleware_spec.rb Added integration test verifying SCRIPT_NAME is honored in redirect to callback
README.md Added comprehensive documentation section explaining SCRIPT_NAME support with Rack and Rails examples
CHANGELOG.md Documented the new feature addition
docs/* Regenerated documentation files with updated timestamps and new content
.rubocop_gradual.lock Updated line number references due to added tests

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +95 to +102
<li id="object_omniauth-ldap-2.3.1.gem" class="even">
<div class="item"><span class="object_link"><a href="file.omniauth-ldap-2.3.1.gem.html" title="omniauth-ldap-2.3.1.gem">omniauth-ldap-2.3.1.gem</a></span></div>
</li>


<li id="object_omniauth-ldap-2.3.1.gem" class="odd">
<div class="item"><span class="object_link"><a href="file.omniauth-ldap-2.3.1.gem.html" title="omniauth-ldap-2.3.1.gem">omniauth-ldap-2.3.1.gem</a></span></div>
</li>
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate list items with the same ID object_omniauth-ldap-2.3.1.gem. HTML IDs must be unique within a document. One of these entries should be removed.

Copilot uses AI. Check for mistakes.
<li class="r2"><a href="file.omniauth-ldap-2.3.1.gem.html" title="omniauth-ldap-2.3.1.gem">omniauth-ldap-2.3.1.gem</a></li>


<li class="r1"><a href="file.omniauth-ldap-2.3.1.gem.html" title="omniauth-ldap-2.3.1.gem">omniauth-ldap-2.3.1.gem</a></li>
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate list items linking to the same gem file. One of these entries should be removed to avoid redundancy.

Suggested change
<li class="r1"><a href="file.omniauth-ldap-2.3.1.gem.html" title="omniauth-ldap-2.3.1.gem">omniauth-ldap-2.3.1.gem</a></li>

Copilot uses AI. Check for mistakes.
- test against all minor versions of omniauth
- test against all minor versions of rack
@github-actions
Copy link

github-actions bot commented Nov 6, 2025

Code Coverage

Package Line Rate Branch Rate Health
omniauth-ldap 98% 82%
Summary 98% (229 / 234) 82% (62 / 76)

Minimum allowed line rate is 97%

@pboling pboling merged commit 1115b69 into main Nov 6, 2025
35 of 37 checks passed
@pboling pboling deleted the feat/support-SCRIPT_NAME branch November 6, 2025 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants